This disclosure relates generally to computer systems and, more particularly, relates to a reader-writer lock. A reader-writer lock controls access to a shared resource, allowing concurrent access to multiple threads for reading but restricting access to a single thread for writes (or other changes) to the resource. A common use might be to control access to a data structure in memory that can not be updated atomically and is not valid (and should not be read by another thread) until the update is complete. Such access to a shared resource may be referred to as a critical section. A thread acquires a read lock before reading the shared resource and releases the read lock after reading the shared resource. Multiple threads may each concurrently hold a read lock. A thread acquires a write lock before writing the shared resource and releases the write lock after writing the shared resource. While a thread holds a write lock, no other thread may hold a read lock nor hold a write lock.